# Image: stateoftheartio/qt6:6.6-gcc-aqt

FROM ubuntu:20.04
MAINTAINER State Of The Art <docker@state-of-the-art.io> (@stateoftheartio)

# PIP requirement like "aqtinstall==2.0.6" or url with egg file
ARG AQT_VERSION="aqtinstall==3.1.7"

ARG QT_VERSION=6.6.3
ARG QT_PATH=/opt/Qt

ARG ADDITIONAL_PACKAGES="sudo git openssh-client ca-certificates build-essential curl python3 locales patchelf"

ENV DEBIAN_FRONTEND=noninteractive \
    DEBCONF_NONINTERACTIVE_SEEN=true \
    QT_VERSION=${QT_VERSION} \
    AQT_VERSION=${AQT_VERSION} \
    QT_PATH=${QT_PATH} \
    QT_GCC=${QT_PATH}/${QT_VERSION}/gcc_64 \
    PATH=${QT_PATH}/Tools/CMake/bin:${QT_PATH}/Tools/Ninja:${QT_PATH}/${QT_VERSION}/gcc_64/bin:$PATH

COPY get_qt.sh install_packages.sh /tmp/

# Get Qt binaries with aqt
RUN /tmp/get_qt.sh

# Install the required packages
RUN /tmp/install_packages.sh

# Reconfigure locale
# RUN locale-gen en_US.UTF-8 && dpkg-reconfigure locales
ENV LANG C.UTF-8

# Fix docker depend
WORKDIR /workspace
COPY CQtDeployer /workspace/CQtDeployer
COPY inja /workspace/inja
COPY FluentUI /workspace/FluentUI
COPY get_project_depend.sh /workspace/get_project_depend.sh
COPY auto_build.sh /workspace/auto_build.sh

# fix project depend
RUN ["sudo", "bash", "/workspace/get_project_depend.sh"]

# auto build script
CMD ["bash", "/workspace/auto_build.sh"]


